﻿using Common.MQ;
using Microsoft.Extensions.DependencyInjection;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Common.RabbitMQ
{
    /// <summary>
    /// 依赖注入扩展
    /// </summary>
    public static class DependencyInjectionExtension
    {
        /// <summary>
        /// 添加RabbitMQ支持
        /// </summary>
        /// <param name="services"></param>
        /// <param name="config"></param>
        /// <returns></returns>
        public static RabbitBuilder AddRabbit(this IServiceCollection services, RabbitConfig config)
        {
            services.AddSingleton(config);
            var builder = new RabbitBuilder(config, services);
            return builder;
        }
    }
}
